#pragma once

#include "Misc/CommonMacros.h"
#include "Containers/SharedObjectPtr.h"
#include "Framework/ApplicationSubsystem.h"
#include "EngineDefaultPackage.m.h"

class RTexture2D;
class RTextureCube;
class RShader;
class RStaticMesh;
class RAssetObject;
class RMaterial;

RCLASS()
class WHENGINE_API REngineDefaultPackage : public RApplicationSubsystem
{

    ROBJECT
public:

    void Initialize() override;
    void Deinitialize() override;

    static REngineDefaultPackage* Get();

    TSharedObjectPtr<RTexture2D> GetEngineIcon();

    TSharedObjectPtr<RTexture2D> GetMinimizeIcon();

    TSharedObjectPtr<RTexture2D> GetMaximizeIcon();

    TSharedObjectPtr<RTexture2D> GetRestoreIcon();

    TSharedObjectPtr<RTexture2D> GetCloseIcon();

    TSharedObjectPtr<RTexture2D> GetFolderIcon();

    TSharedObjectPtr<RTexture2D> GetAddFolderIcon();

    TSharedObjectPtr<RTexture2D> GetAddFileIcon();

    TSharedObjectPtr<RTexture2D> GetRefreshIcon();

    TSharedObjectPtr<RTexture2D> GetCheckBoxCheckedIcon();

    TSharedObjectPtr<RTexture2D> GetCheckBoxUnCheckedIcon();

    TSharedObjectPtr<RTexture2D> GetCheckBoxNotAllCheckedIcon();

protected:
    TSharedObjectPtr<RTexture2D> EngineIcon;
    TSharedObjectPtr<RTexture2D> MinimizeIcon;
    TSharedObjectPtr<RTexture2D> MaximizeIcon;
    TSharedObjectPtr<RTexture2D> RestoreIcon;
    TSharedObjectPtr<RTexture2D> CloseIcon;
    TSharedObjectPtr<RTexture2D> FolderIcon;
    TSharedObjectPtr<RTexture2D> AddFolderIcon;
    TSharedObjectPtr<RTexture2D> AddFileIcon;
    TSharedObjectPtr<RTexture2D> RefreshIcon;
    TSharedObjectPtr<RTexture2D> CheckBoxCheckedIcon;
    TSharedObjectPtr<RTexture2D> CheckBoxUnCheckedIcon;
    TSharedObjectPtr<RTexture2D> CheckBoxNotAllCheckedIcon;
    TSharedObjectPtr<RTextureCube> DefaultSkyBoxTexture;
public:

    TSharedObjectPtr<RShader> GetDefaultMeshVertexShader();
    TSharedObjectPtr<RShader> GetDefaultMeshFragmentShader();
    TSharedObjectPtr<RShader> GetDefaultSelfLightingFragmentShader();
    TSharedObjectPtr<RShader> GetDefaultSkyBoxFragmentShader();

    //这是一个单色材质，以这个材质为模板创建动态材质就可以改变颜色
    TSharedObjectPtr<RShader> GetSingleColorFragmentShader();
    
protected:
    TSharedObjectPtr<RShader> DefaultMeshVertexShader;
    TSharedObjectPtr<RShader> DefaultMeshFragmentShader;
    TSharedObjectPtr<RShader> DefaultSelfLightingFragmentShader;
    TSharedObjectPtr<RShader> DefaultSkyBoxFragmentShader;
    TSharedObjectPtr<RShader> SingleColorFragmentShader;

public:
    TSharedObjectPtr<RMaterial> GetDefaultMaterial();
    TSharedObjectPtr<RMaterial> GetDefaultSkyBoxMaterial();

protected:
    TSharedObjectPtr<RMaterial> DefaultMaterial;
    TSharedObjectPtr<RMaterial> DefaultSkyBoxMaterial;

public:
    TSharedObjectPtr<RStaticMesh> GetCubeMesh();

    TSharedObjectPtr<RStaticMesh> GetSphereMesh();

    TSharedObjectPtr<RStaticMesh> GetAxisMesh();
protected:
    TSharedObjectPtr<RStaticMesh> CubeMesh;

    TSharedObjectPtr<RStaticMesh> SphereMesh;

    TSharedObjectPtr<RStaticMesh> AxisMesh;
};


namespace WH
{
    WHENGINE_API TSharedObjectPtr<RAssetObject> GetDefaultAssetObject();

}